# befriend
# conquer
# antagonize
# build_ship
# build_army
# unit_ratio
# build_building
# research_tech
# garrison
# protect
# influence

CHI_unit_production = {
	allowed = { original_tag = CHI }
	enable = {
		always = yes
	}
	abort = {
		always = no
	}
	
	ai_strategy = {
		type = role_ratio
		id = garrison
		value = 0
	}


	ai_strategy = {
		type = role_ratio
		id = paratroopers
		value = 0
	}

	ai_strategy = {
		type = role_ratio
		id = mountaineers
		value = 0
	}

	ai_strategy = {
		type = role_ratio
		id = marines
		value = 0
	}

	ai_strategy = {
		type = role_ratio
		id = armor
		value = -10
	}

	ai_strategy = {
		type = role_ratio
		id = infantry
		value = 100
	}
	
	#Air unit factors
	ai_strategy = {
		type = unit_ratio
		id = fighter
		value = 75 # From 70 to 75
	}
	
	ai_strategy = {
		type = unit_ratio
		id = cas
		value = 0
	}
	
	ai_strategy = {
		type = unit_ratio
		id = tactical_bomber
		value = 0
	}
	
	ai_strategy = {
		type = unit_ratio
		id = strategic_bomber
		value = 0
	}
	
	ai_strategy = {
		type = unit_ratio
		id = naval_bomber
		value = 0
	}
	
	
	# Naval unit factors
	ai_strategy = {
		type = unit_ratio
		id = capital_ship
		value = 25 # from 15 to 25
	}

	ai_strategy = {
		type = unit_ratio
		id = submarine
		value = 40 #from 50 to 40
	}

	ai_strategy = {
		type = unit_ratio
		id = screen_ship
		value = 20
	}

	ai_strategy = {
		type = unit_ratio
		id = convoy
		value = 20
	}
	
	ai_strategy = {
		type = equipment_production_factor
		id = fighter
		value = 20
	}
	
	ai_strategy = {
		type = equipment_production_factor
		id = infantry
		value = 35
	}
	
	ai_strategy = {
		type = equipment_production_factor
		id = artillery
		value = 25
	}
	
	ai_strategy = {
		type = equipment_production_factor
		id = armor
		value = 0
	}
	
	ai_strategy = {
		type = ignore_army_incompetence
		value = 50
	}
}

CHI_dont_waste_on_offensive_air_early = {
	allowed = { original_tag = CHI }
	enable = {
		date < 1940.1.1
	}
	abort = {
		date > 1940.1.1
	}

	ai_strategy = {
		type = equipment_variant_production_factor
		id = tac_bomber_equipment
		value = -100
	}
	
	ai_strategy = {
		type = equipment_variant_production_factor
		id = strat_bomber_equipment
		value = -100
	}
}

CHI_armored_production = {
	allowed = { original_tag = CHI }
	enable = {
		ai_wants_divisions > 0 #Decreasing the amount of tanks the AI wants
	}
	abort = {
		ai_wants_divisions < 1 #Decreasing the amount of tanks the AI wants
	}

	ai_strategy = {
		type = role_ratio
		id = armor
		value = 0
	}
}

CHI_highered_armored_production = {
	allowed = { original_tag = CHI }
	enable = {
		num_of_military_factories > 109
	}
	abort = {
		num_of_military_factories < 110
	}

	ai_strategy = {
		type = role_ratio
		id = armor
		value = 0
	}
}

CHI_prio_military_even_at_peace = {
	allowed = { original_tag = CHI }
	enable = {
		always = yes
	}
	
	ai_strategy = {
		type = added_military_to_civilian_factory_ratio
		value = 50
	}
	
}
	
CHI_dont_mess_with_the_soviets = {

	allowed = { original_tag = CHI }
	enable = {	
		NOT = { has_war_with = SOV }
	}
	
	abort = {
		has_war_with = SOV
	}

	ai_strategy = {
		type = contain
		id = "SOV"			
		value = -200
	}
}

CHI_some_safer_places_to_build = {
	allowed = { original_tag = CHI }
	enable = {
		always = yes
	}

	abort = {
		date > 1941.1.1
	}

	ai_strategy = {
        type = factory_build_score_factor
        target =  602
        value = 300
    }

	ai_strategy = {
        type = factory_build_score_factor
        target =  605
        value = 300
    }
}

CHI_you_should_be_prepared_for_war = {
	allowed = { 
		is_literally_china = yes
	}
	enable = {
		always = yes
	}
	abort_when_not_enabled = yes
	
	ai_strategy = {
        type = force_build_armies
        value = 100
    }
}

CHI_buffer_in_mainland = {
	allowed = {
		is_literally_china = yes
	}
	enable = {
		date < 1941.1.1
	}
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = put_unit_buffers
		states = {
			620 #Mainland china, without coast. This should slow down japanese advance due to tendency for china to retreat in disarray.
			602
			600
			750
			603
			748
			605
		}
		ratio = 0.15
		area = asia
		subtract_invasions_from_need = no
		subtract_fronts_from_need = no
	}
}

CHI_hunker_down_now  = {
	allowed = {
		original_tag = CHI
	}

	enable = {
		date < 1945.1.1 #We accept our fate after this point
		has_war_with = JAP
		is_historical_focus_on = yes
		surrender_progress > 0.5
	}

	abort = {
		date > 1945.1.1 #We accept our fate after this point
	}

	ai_strategy = {
		type = front_control

		tag = JAP

		ratio = 0.6

		priority = 100
		ordertype = front
		execution_type = careful
	}

}
